export default {
  data() {
    return {
      index: -1,
      picker: ['5%', '6%', '7%', '8%', '9%', '10%', '11%', '12%'],
      socialTax: '',
      fundTax: '',
      monthMoney: 0,
      socialMoney: 0,
      fundMoney: 0,
      fundPercent: null
    }
  },
  watch: {

  },
  methods: {
    PickerChange(e) {
      this.index = e.detail.value
      this.fundPercent = this.picker[e.detail.value].replace('%', '') / 100
    },

    //重置
    resetBtn() {
      this.socialTax = ''
      this.fundTax = ''
      this.monthMoney = 0
      this.fundMoney = 0
      this.socialMoney = 0
      this.index = -1
    },
    //计算
    countBtn() {
      if (this.fundTax == '' && this.index == -1) {
        this.$tools.msg('请选择公积金缴纳比例')
        return
      }
      if (this.socialTax != 0) {
        const firm_endowment = Number((this.socialTax * 0.16).toFixed(2))
        const per_endowment = Number((this.socialTax * 0.08).toFixed(2))
        const firm_medicare = Number((this.socialTax * 0.064).toFixed(2))
        const per_medicare = Number((this.socialTax * 0.02).toFixed(2))
        const firm_unemployment = Number((this.socialTax * 0.005).toFixed(2))
        const per_unemployment = Number((this.socialTax * 0.005).toFixed(2))
        const firm_injury = Number((this.socialTax * 0.002).toFixed(2))
        const per_injury = 0
        const firm_birth = 0
        const per_birth = 0
        this.socialMoney = firm_endowment + per_endowment + firm_medicare + per_medicare + firm_unemployment + per_unemployment + firm_injury
      }
      if (this.fundTax != 0 && this.index != -1) {
        const firm_fund = (this.fundTax * this.fundPercent).toFixed(2)
        this.fundMoney = Number(firm_fund) * 2
      }
      this.monthMoney = this.socialMoney + this.fundMoney
    }
  }
}